import java.util.Random;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Jun Xu
 * Date：2024/1/3
 * Time: 15:39
 */
public class test {
    public static void main(String[] args) {



        //char ch = 'A';
        //System.out.println(ch);

        //int a = 10;
        //int b = 20;
        //System.out.println(a&b);

//        int a = 0xf;
        //System.out.printf("%x\n",~a);

       /* Scanner sc = new Scanner(System.in);
        System.out.println("请输入你的姓名: ");
        String name = sc.nextLine();
        System.out.println("请输入你的年龄: ");
        int age = sc.nextInt();
        System.out.println("请输入你的工资: ");
        float salary = sc.nextFloat();
        System.out.println("你的信息如下: ");
        System.out.println("姓名"+ name + "年龄" + age + "工资" + salary);
        sc.close();*/

        //猜数字小游戏
        /*Random random = new Random();
        Scanner scanner = new Scanner(System.in);

        int Guess = random.nextInt(100);//生成一个0-99的随机整数 不包含99

        while(true){
            System.out.println("请输入你要猜的数字: ");
            int num = scanner.nextInt();
            if (num < Guess)
                System.out.println("小了");
            if (num > Guess)
                System.out.println("大了");
            if (num ==Guess) {
                System.out.println("猜对了!");
                break;
            }
        }
        scanner.close();*/
        /*int[] nums = {1,3,5,6};
        int target = 2;
        int i = searchInsert(nums,target);*/

        public int searchInsert(int[] nums, int target) {

            int left = 0;
            int right = nums.length - 1;
            int mid = 0;

            while(left <= right){
                int mid = (left + right) / 2;
                if (nums[mid] == target)
                    return mid;
                if (nums[mid] < target)
                    left = mid + 1;
                if (nums[mid] > target)
                    right = mid - 1;
            }


        }


    }

}
